//package xin.clips.web.service;
//
//
//import org.osgi.service.component.annotations.Component;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.web.socket.TextMessage;
//import org.springframework.web.socket.WebSocketSession;
//import org.springframework.web.socket.handler.TextWebSocketHandler;
//import xin.clips.web.util.TCPUtil;
//
//import java.io.IOException;
//import java.nio.ByteBuffer;
//import java.nio.ByteOrder;
//
///*https://www.javainuse.com/spring/boot-websocket*/
//@Component
//public class SocketTextHandler extends TextWebSocketHandler {
//    private static final Logger log = LoggerFactory.getLogger(SocketTextHandler.class);
//
//    @Override
//    public void handleTextMessage(WebSocketSession session, TextMessage message)
//            throws InterruptedException, IOException {
//        byte[] bytes = message.asBytes();
//        log.info("websocket接收到的数据(字符串）：" + message.getPayload());
//        log.info("websocket接收到的数据(字节数组）:" + bytes);
//        // session.sendMessage(new TextMessage("Hi " + jsonObject.get("user") + " how may we help you?"));
//        TCPUtil tcpUtil = new TCPUtil();
//        ByteBuffer b = ByteBuffer.wrap(bytes);
//        b.order(ByteOrder.LITTLE_ENDIAN);
//        tcpUtil.setByteBuffer(b, 0);
//      //  log.info("任务名称：" + tcpUtil.getName());
//    }
//
//}